package com.du;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;

/**
 * @author : DuJiabao
 * @Date : 2021/1/30 13:25
 * @Project : java-web
 * @File : null.java
 * @Desc :
 */
public class SearchStudentsServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ArrayList<Student> students = new ArrayList<>();
        // 模拟一个List出来
        for (int i = 0; i < 10; i++) {
            students.add(new Student(i, "name" + i, "" + i + i + i, i + 10));
        }
        req.setAttribute("students", students);
        req.getRequestDispatcher("/showStudent.jsp").forward(req, resp);
    }
}
